Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
@babel/helper-replace-supers
Advanced tools
@babel/helper-replace-supers is a Babel helper module that assists in handling super method calls and super property accesses in JavaScript classes. It is particularly useful when transforming ES6+ code to ES5, ensuring that the semantics of super calls are preserved correctly.
Super Method Call Replacement
This feature allows you to replace super method calls within a class method. The `replaceSuper` function is used to handle the transformation, ensuring that the correct object and super references are maintained.
const { replaceSuper } = require('@babel/helper-replace-supers');
function replaceSuperMethodCall(path, state) {
replaceSuper(path, state, {
getObjectRef() {
return path.node.object;
},
getSuperRef() {
return path.node.super;
},
file: state.file
});
}
Super Property Access Replacement
This feature allows you to replace super property accesses within a class. Similar to method call replacement, the `replaceSuper` function ensures that property accesses are correctly transformed.
const { replaceSuper } = require('@babel/helper-replace-supers');
function replaceSuperPropertyAccess(path, state) {
replaceSuper(path, state, {
getObjectRef() {
return path.node.object;
},
getSuperRef() {
return path.node.super;
},
file: state.file
});
}
This plugin is part of the Babel preset for transforming ES2015 (ES6) classes to ES5. It handles super method calls and property accesses, ensuring compatibility with older JavaScript environments.
Helper function to replace supers
See our website @babel/helper-replace-supers for more information.
Using npm:
npm install --save @babel/helper-replace-supers
or using yarn:
yarn add @babel/helper-replace-supers
FAQs
Helper function to replace supers
The npm package @babel/helper-replace-supers receives a total of 18,285,077 weekly downloads. As such, @babel/helper-replace-supers popularity was classified as popular.
We found that @babel/helper-replace-supers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.